
package cz.uhk.ppro.response.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * třída Teacher od Persona dědí atribut firstName, LastName
 * Učitel má více kurzů (arrayList)
 *
 * @author Martin Zmítko <martin.zmitko@gmail.com>
 */

@Entity
@Table(name="TEACHERS")
public class Teacher extends Person implements Serializable {

    private String address;

    private String city;

    private String telephone;

    // pro login
    private String username;
    private String password;
    private boolean enabled;

    @OneToOne(mappedBy = "teacher")
    private TeacherRoles role;

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public TeacherRoles getRole() {
        return role;
    }

    public void setRole(TeacherRoles role) {
        this.role = role;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * Ucitel má své kurzy
     */
    @OneToMany(mappedBy="teacher", fetch=FetchType.LAZY)
    private List<Course> courses;

    public String getFullName()
    {
        return this.getFirstName() + " " + this.getLastName();
    }

    public List<Course> getCourses() {
        return courses;
    }

    public void setCourses(List<Course> courses) {
        this.courses = courses;
    }


        public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getCity() {
		return this.city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getTelephone() {
		return this.telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}



}
